import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';

@Entity('tag', { schema: 'blog_back' })
export class Tag {
  @PrimaryGeneratedColumn({ type: 'int', name: 'id', unsigned: true })
  id: number;

  @Column('varchar', { name: 'name', length: 63 })
  name: string;

  @Column('varchar', { name: 'cover_url', nullable: true, length: 255 })
  coverUrl: string | null;

  @Column('timestamp', {
    name: 'create_time',
    default: () => 'CURRENT_TIMESTAMP',
  })
  createTime: Date;

  @Column('timestamp', {
    name: 'update_time',
    default: () => 'CURRENT_TIMESTAMP',
  })
  updateTime: Date;
}
